3.2.15 \(\int \frac {\sin ^2(a+\frac {b}{x})}{x^2} \, dx\) [115]

Optimal. Leaf size=31 \[ -\frac {1}{2 x}+\frac {\cos \left (a+\frac {b}{x}\right ) \sin \left (a+\frac {b}{x}\right )}{2 b} \]

[Out]

-1/2/x+1/2*cos(a+b/x)*sin(a+b/x)/b

________________________________________________________________________________________

Rubi [A]
time = 0.02, antiderivative size = 31, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, integrand size = 14, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.214, Rules used = {3460, 2715, 8} \begin {gather*} \frac {\sin \left (a+\frac {b}{x}\right ) \cos \left (a+\frac {b}{x}\right )}{2 b}-\frac {1}{2 x} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[Sin[a + b/x]^2/x^2,x]

[Out]

-1/2*1/x + (Cos[a + b/x]*Sin[a + b/x])/(2*b)

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 2715

Int[((b_.)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[(-b)*Cos[c + d*x]*((b*Sin[c + d*x])^(n - 1)/(d*n))
, x] + Dist[b^2*((n - 1)/n), Int[(b*Sin[c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1] && Integ
erQ[2*n]

Rule 3460

Int[(x_)^(m_.)*((a_.) + (b_.)*Sin[(c_.) + (d_.)*(x_)^(n_)])^(p_.), x_Symbol] :> Dist[1/n, Subst[Int[x^(Simplif
y[(m + 1)/n] - 1)*(a + b*Sin[c + d*x])^p, x], x, x^n], x] /; FreeQ[{a, b, c, d, m, n, p}, x] && IntegerQ[Simpl
ify[(m + 1)/n]] && (EqQ[p, 1] || EqQ[m, n - 1] || (IntegerQ[p] && GtQ[Simplify[(m + 1)/n], 0]))

Rubi steps

\begin {align*} \int \frac {\sin ^2\left (a+\frac {b}{x}\right )}{x^2} \, dx &=-\text {Subst}\left (\int \sin ^2(a+b x) \, dx,x,\frac {1}{x}\right )\\ &=\frac {\cos \left (a+\frac {b}{x}\right ) \sin \left (a+\frac {b}{x}\right )}{2 b}-\frac {1}{2} \text {Subst}\left (\int 1 \, dx,x,\frac {1}{x}\right )\\ &=-\frac {1}{2 x}+\frac {\cos \left (a+\frac {b}{x}\right ) \sin \left (a+\frac {b}{x}\right )}{2 b}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.04, size = 32, normalized size = 1.03 \begin {gather*} -\frac {a+\frac {b}{x}}{2 b}+\frac {\sin \left (2 \left (a+\frac {b}{x}\right )\right )}{4 b} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Sin[a + b/x]^2/x^2,x]

[Out]

-1/2*(a + b/x)/b + Sin[2*(a + b/x)]/(4*b)

________________________________________________________________________________________

Maple [A]
time = 0.04, size = 34, normalized size = 1.10

method result size
risch \(-\frac {1}{2 x}+\frac {\sin \left (\frac {2 a x +2 b}{x}\right )}{4 b}\) \(23\)
derivativedivides \(-\frac {-\frac {\cos \left (a +\frac {b}{x}\right ) \sin \left (a +\frac {b}{x}\right )}{2}+\frac {a}{2}+\frac {b}{2 x}}{b}\) \(34\)
default \(-\frac {-\frac {\cos \left (a +\frac {b}{x}\right ) \sin \left (a +\frac {b}{x}\right )}{2}+\frac {a}{2}+\frac {b}{2 x}}{b}\) \(34\)
norman \(\frac {-\frac {1}{2}+\frac {x \tan \left (\frac {a}{2}+\frac {b}{2 x}\right )}{b}-\left (\tan ^{2}\left (\frac {a}{2}+\frac {b}{2 x}\right )\right )-\frac {\left (\tan ^{4}\left (\frac {a}{2}+\frac {b}{2 x}\right )\right )}{2}-\frac {x \left (\tan ^{3}\left (\frac {a}{2}+\frac {b}{2 x}\right )\right )}{b}}{\left (1+\tan ^{2}\left (\frac {a}{2}+\frac {b}{2 x}\right )\right )^{2} x}\) \(89\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(sin(a+b/x)^2/x^2,x,method=_RETURNVERBOSE)

[Out]

-1/b*(-1/2*cos(a+b/x)*sin(a+b/x)+1/2*a+1/2*b/x)

________________________________________________________________________________________

Maxima [A]
time = 0.29, size = 25, normalized size = 0.81 \begin {gather*} \frac {x \sin \left (\frac {2 \, {\left (a x + b\right )}}{x}\right ) - 2 \, b}{4 \, b x} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(a+b/x)^2/x^2,x, algorithm="maxima")

[Out]

1/4*(x*sin(2*(a*x + b)/x) - 2*b)/(b*x)

________________________________________________________________________________________

Fricas [A]
time = 0.37, size = 34, normalized size = 1.10 \begin {gather*} \frac {x \cos \left (\frac {a x + b}{x}\right ) \sin \left (\frac {a x + b}{x}\right ) - b}{2 \, b x} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(a+b/x)^2/x^2,x, algorithm="fricas")

[Out]

1/2*(x*cos((a*x + b)/x)*sin((a*x + b)/x) - b)/(b*x)

________________________________________________________________________________________

Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 262 vs. \(2 (20) = 40\).
time = 1.25, size = 262, normalized size = 8.45 \begin {gather*} \begin {cases} - \frac {b \tan ^{4}{\left (\frac {a}{2} + \frac {b}{2 x} \right )}}{2 b x \tan ^{4}{\left (\frac {a}{2} + \frac {b}{2 x} \right )} + 4 b x \tan ^{2}{\left (\frac {a}{2} + \frac {b}{2 x} \right )} + 2 b x} - \frac {2 b \tan ^{2}{\left (\frac {a}{2} + \frac {b}{2 x} \right )}}{2 b x \tan ^{4}{\left (\frac {a}{2} + \frac {b}{2 x} \right )} + 4 b x \tan ^{2}{\left (\frac {a}{2} + \frac {b}{2 x} \right )} + 2 b x} - \frac {b}{2 b x \tan ^{4}{\left (\frac {a}{2} + \frac {b}{2 x} \right )} + 4 b x \tan ^{2}{\left (\frac {a}{2} + \frac {b}{2 x} \right )} + 2 b x} - \frac {2 x \tan ^{3}{\left (\frac {a}{2} + \frac {b}{2 x} \right )}}{2 b x \tan ^{4}{\left (\frac {a}{2} + \frac {b}{2 x} \right )} + 4 b x \tan ^{2}{\left (\frac {a}{2} + \frac {b}{2 x} \right )} + 2 b x} + \frac {2 x \tan {\left (\frac {a}{2} + \frac {b}{2 x} \right )}}{2 b x \tan ^{4}{\left (\frac {a}{2} + \frac {b}{2 x} \right )} + 4 b x \tan ^{2}{\left (\frac {a}{2} + \frac {b}{2 x} \right )} + 2 b x} & \text {for}\: b \neq 0 \\- \frac {\sin ^{2}{\left (a \right )}}{x} & \text {otherwise} \end {cases} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(a+b/x)**2/x**2,x)

[Out]

Piecewise((-b*tan(a/2 + b/(2*x))**4/(2*b*x*tan(a/2 + b/(2*x))**4 + 4*b*x*tan(a/2 + b/(2*x))**2 + 2*b*x) - 2*b*
tan(a/2 + b/(2*x))**2/(2*b*x*tan(a/2 + b/(2*x))**4 + 4*b*x*tan(a/2 + b/(2*x))**2 + 2*b*x) - b/(2*b*x*tan(a/2 +
 b/(2*x))**4 + 4*b*x*tan(a/2 + b/(2*x))**2 + 2*b*x) - 2*x*tan(a/2 + b/(2*x))**3/(2*b*x*tan(a/2 + b/(2*x))**4 +
 4*b*x*tan(a/2 + b/(2*x))**2 + 2*b*x) + 2*x*tan(a/2 + b/(2*x))/(2*b*x*tan(a/2 + b/(2*x))**4 + 4*b*x*tan(a/2 +
b/(2*x))**2 + 2*b*x), Ne(b, 0)), (-sin(a)**2/x, True))

________________________________________________________________________________________

Giac [A]
time = 6.41, size = 29, normalized size = 0.94 \begin {gather*} -\frac {\frac {2 \, {\left (a x + b\right )}}{x} - \sin \left (\frac {2 \, {\left (a x + b\right )}}{x}\right )}{4 \, b} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(a+b/x)^2/x^2,x, algorithm="giac")

[Out]

-1/4*(2*(a*x + b)/x - sin(2*(a*x + b)/x))/b

________________________________________________________________________________________

Mupad [B]
time = 4.57, size = 22, normalized size = 0.71 \begin {gather*} \frac {\sin \left (2\,a+\frac {2\,b}{x}\right )}{4\,b}-\frac {1}{2\,x} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(sin(a + b/x)^2/x^2,x)

[Out]

sin(2*a + (2*b)/x)/(4*b) - 1/(2*x)

________________________________________________________________________________________